Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxGUI: Check min required wx version when starting GUI #2990

Merged
merged 3 commits into from
Jun 7, 2023

Conversation

landam
Copy link
Member

@landam landam commented Jun 2, 2023

Currently wxGUI fails on wxPython 4.0.x with non-clear traceback:

Launching <wxpython> GUI in the background, please wait...

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/wx/core.py", line 3282, in <lambda>
    lambda event: event.callable(*event.args, **event.kw) )
  File "/home/landa/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/wxgui.py", line 100, in show_main_gui
    mainframe = GMFrame(parent=None, id=wx.ID_ANY, workspace=self.workspaceFile)
  File "/home/landa/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/main_window/frame.py", line 167, in __init__
    self.BuildPanes()
  File "/home/landa/src/grass/dist.x86_64-pc-linux-gnu/gui/wxpython/main_window/frame.py", line 658, in BuildPanes
    self._auimgr.AddPane(
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/framemanager.py", line 4711, in AddPane
    return self.AddPane4(window, arg1, target)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/framemanager.py", line 4879, in AddPane4
    self.UpdateNotebook()
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/framemanager.py", line 6653, in UpdateNotebook
    notebook.AddPage(pane.window, title, True, pane.icon)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 3575, in AddPage
    return self.InsertPage(self.GetPageCount(), page, caption, select, bitmap, disabled_bitmap, control, tooltip)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 3653, in InsertPage
    self.SetSelectionToWindow(page)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 4410, in SetSelectionToWindow
    self.SetSelection(idx)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 4357, in SetSelection
    ctrl.MakeTabVisible(ctrl_idx, ctrl)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 1843, in MakeTabVisible
    if not self.IsTabVisible(tabPage, self.GetTabOffset(), dc, win):
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 1732, in IsTabVisible
    self.Render(dc, wnd)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/auibook.py", line 1687, in Render
    page.rect, tab_button.rect, x_extent = self._art.DrawTab(dc, wnd, page, rect, tab_button.cur_state)
  File "/usr/lib/python3/dist-packages/wx/lib/agw/aui/tabart.py", line 475, in DrawTab
    r.SetHeight(r.GetHeight()/2)
TypeError: Rect.SetHeight(): argument 1 has unexpected type 'float'

This PR adds a warning which informs user at least about minimal required wxPython version:

Launching <wxpython> GUI in the background, please wait...
WARNING: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WARNING: Minimum required WxPython version: 4.2.0
WARNING: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Traceback (most recent call last):
...

@landam landam added the GUI wxGUI related label Jun 2, 2023
@landam landam added this to the 8.3.0 milestone Jun 2, 2023
@landam landam self-assigned this Jun 2, 2023
@landam landam requested a review from petrasovaa June 2, 2023 09:58
@petrasovaa
Copy link
Contributor

I tried to improve it, so that the message is more helpful and it is shown only when an error actual occurs. In that case it is printed after the error to make it visible.

@wenzeslaus wenzeslaus changed the title Check min required wx version when starting wxgui wxGUI: Check min required wx version when starting GUI Jun 6, 2023
@landam
Copy link
Member Author

landam commented Jun 6, 2023

I tested your changes and it works:

VirtualBox_jammy_default_1654675740284_89704_06_06_2023_18_04_42

@landam
Copy link
Member Author

landam commented Jun 6, 2023

@petrasovaa If no objection I will merge it to main and backport to 8.3.

@landam landam modified the milestones: 8.3.0, 8.4.0 Jun 6, 2023
@landam landam merged commit d10351c into OSGeo:main Jun 7, 2023
@landam landam deleted the min_req_wx_version branch June 7, 2023 14:04
landam added a commit that referenced this pull request Jun 7, 2023
Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
@landam landam modified the milestones: 8.4.0, 8.3.0 Jun 7, 2023
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI wxGUI related
Development

Successfully merging this pull request may close these issues.

2 participants